"use strict"

/**
 * 北京市政府采购中心爬虫
 *  
 */

var Base = require("./base");
var bjs_spider = new Base();
bjs_spider.name = "北京市政府采购中心";
bjs_spider.timeout = 30000;
bjs_spider.encode = "utf-8";

bjs_spider.getPageUrl = function (pg) {
    var url = "http://www.bgpc.gov.cn/defaults/news/news/page/1%2Ftid%2F9";
    if (pg != 1) {
        url = "http://www.bgpc.gov.cn/defaults/news/news/page/"+ pg + "%2Ftid%2F9";
    }
    return url;
}
bjs_spider.getItems = function ($) {
    var items = [];
    $(".content-right-content-center li>a").each(function (index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.text();
        item.url = "http://www.bgpc.gov.cn" + e.attr("href");
        item.source = bjs_spider.name;
        items.push(item);
    });
    return items;
}

exports = module.exports = bjs_spider;